import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceSubscribeVO, ServiceSubscribeForm, ServiceSubscribeQuery } from '@/api/office/service/subscribe/types';

/**
 * 查询服务包订阅列表
 * @param query
 * @returns {*}
 */

export const listServiceSubscribe = (query?: ServiceSubscribeQuery): AxiosPromise<ServiceSubscribeVO[]> => {
  return request({
    url: '/office/service/subscribe/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务包订阅详细
 * @param id
 */
export const getServiceSubscribe = (id: string | number): AxiosPromise<ServiceSubscribeVO> => {
  return request({
    url: '/office/service/subscribe/' + id,
    method: 'get'
  });
};

/**
 * 新增服务包订阅
 * @param data
 */
export const addServiceSubscribe = (data: ServiceSubscribeForm) => {
  return request({
    url: '/office/service/subscribe',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务包订阅
 * @param data
 */
export const updateServiceSubscribe = (data: ServiceSubscribeForm) => {
  return request({
    url: '/office/service/subscribe',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务包订阅
 * @param id
 */
export const delServiceSubscribe = (id: string | number | Array<string | number>) => {
  return request({
    url: '/office/service/subscribe/' + id,
    method: 'delete'
  });
};
